package com.课上案例练习.网络编程.Tcp编程聊天版本3.接收的线程;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.Socket;

public class ServerThreadinput extends Thread{
    private Socket socket;

    public ServerThreadinput(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        while (true){
            DataInputStream dataInputStream = null;
            try {
                dataInputStream = new DataInputStream(socket.getInputStream());
                System.out.println(dataInputStream.readUTF());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }
    }
}